package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Reply;
import cn.wolfcode.trip.base.mapper.ReplyMapper;
import cn.wolfcode.trip.base.service.IReplyService;
import cn.wolfcode.trip.base.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReplyServiceImpl implements IReplyService {
    @Autowired
    private ReplyMapper replyMapper;

    @Override
    public void save(Reply reply) {
        System.out.println(UserContext.getCurrentUser());
        reply.setFromUser(UserContext.getCurrentUser());
        replyMapper.insert(reply);
    }

    @Override
    public List<Reply> Query(Long commentId) {
        return replyMapper.selectForList(commentId);
    }
}
